package com.tony.akka;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;

/**
 * @version V1.0  </br>
 * @ClassName AkkaQuickstart </br>
 * @Description TODO  </br>
 * @Author tonywang</br>
 * @DATE 3/18/2019 11:26 AM</br>
 */
public class AkkaQuickstart {
    public static void main(String[] args){
        final ActorSystem system = ActorSystem.create("quickStart");
        ActorRef printActor = system.actorOf(Printer.props(), "printActor");

        ActorRef howdyActor = system.actorOf(Greeter.props("Howdy", printActor), "howdyGreeter");
        ActorRef moonDay = system.actorOf(Greeter.props("MoonDay", printActor), "moonDayGreeter");
        ActorRef thusDay = system.actorOf(Greeter.props("thusDay", printActor), "thusDayGreeter");
        ActorRef threeDay = system.actorOf(Greeter.props("threeDay", printActor), "threeDayGreeter");


        howdyActor.tell(new Greeter.WhoToGreet("java"), ActorRef.noSender());
        howdyActor.tell(new Greeter.Greet(), ActorRef.noSender());
        moonDay.tell(new Greeter.WhoToGreet("one"), ActorRef.noSender());
        moonDay.tell(new Greeter.Greet(), ActorRef.noSender());
        thusDay.tell(new Greeter.WhoToGreet("two"), ActorRef.noSender());
        thusDay.tell(new Greeter.Greet(), ActorRef.noSender());
        threeDay.tell(new Greeter.WhoToGreet("three"), ActorRef.noSender());
        threeDay.tell(new Greeter.Greet(), ActorRef.noSender());


    }
}
